#-*- coding:utf-8 -*-
import re


#简单的正则
# patten='^song'
# print re.search(patten, "song")

#{n,m}
pat='^M{0,8}$'
print re.search(pat, 'M')